package com.fjsh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fjsh.entity.TbPermission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 权限表 Mapper 接口
 */
@Mapper
public interface TbPermissionMapper extends BaseMapper<TbPermission> {
    @Select("SELECT tp.* FROM `tb_permission` tp LEFT JOIN tb_role_permission trp ON tp.id = trp.permission_id LEFT JOIN tb_user_role tur ON trp.role_id = tur.role_id LEFT JOIN tb_user tu ON tur.user_id = tu.id WHERE tu.id=#{id}")
    List<TbPermission> getPermissionList(@Param("id") Long id);
}
